package com.nbsaas.boot.store.rest.convert;

import com.nbsaas.boot.store.data.entity.StoreCheckInRecord;
import com.nbsaas.boot.store.api.domain.request.StoreCheckInRecordRequest;

import org.springframework.beans.BeanUtils;
import com.nbsaas.boot.rest.api.Converter;
import com.nbsaas.boot.utils.BeanDataUtils;
            import com.nbsaas.boot.store.data.entity.Store;
            import com.nbsaas.boot.customer.data.entity.Customer;

/**
* 请求对象转换成实体对象
*/

public class StoreCheckInRecordEntityConvert  implements Converter<StoreCheckInRecord, StoreCheckInRecordRequest> {

    @Override
    public StoreCheckInRecord convert(StoreCheckInRecordRequest source) {
        StoreCheckInRecord result = new StoreCheckInRecord();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getStore()!=null){
                    Store store =new Store();
                    store.setId(source.getStore());
                    result.setStore(store);
                    }
                    if(source.getCustomer()!=null){
                    Customer customer =new Customer();
                    customer.setId(source.getCustomer());
                    result.setCustomer(customer);
                    }
        return result;
    }
}

